import {defineConfig, loadEnv} from "vite";
import viteBasicConfig from "./vite.basic.config";
import viteDevelopmentConfig from "./vite.development.config";
import viteProConfig from "./vite.pro.config";

const envResolve = {
    serve: () => {
        console.log("env：development");
        return Object.assign({}, viteBasicConfig, viteDevelopmentConfig, )
    },
    build: () => {
        console.log("env：production");
        return Object.assign({}, viteBasicConfig, viteProConfig,)
    }
}

export default defineConfig(({command, mode})=>{
    loadEnv(mode, process.cwd(), '');
    return envResolve[command]()
})